package com.example;

import javax.swing.*;
import java.awt.*;

/**
 * @ClassName: leetcode
 * @Description:
 * @Author: csp
 * @Date:
 */
public class Wuziqi {
    private JFrame frame;
    public void qp(){
        JFrame frame = new JFrame();
        frame.setLocation(500,300);
        frame.setTitle("五子棋");
        frame.setSize(1000, 1000);
        frame.setResizable(false);
        frame.setVisible(true);
        frame.getContentPane().setBackground(new Color(240, 233, 217));//修改背景颜色
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.frame = frame;
    }
    public void paint(Graphics g) {
        frame.paint(g);
        drawChessTable(g);
    }

    public  void drawChessTable(Graphics g) {
        for (int i = 0; i < 19; i++) {
            g.drawLine(50, 50 + i * 50, 50
                    + (19 - 1) * 50, 50 + i
                    * 50);
        }

        for (int j = 0; j < 19; j++) {
            g.drawLine(50 + j * 50, 50, 50 + j
                    * 50, 50 + (19 - 1)
                    * 50);
        }
    }

    public static void main(String[] args) {
        Wuziqi wuziqi = new Wuziqi();
        wuziqi.qp();
        wuziqi.paint(wuziqi.frame.getGraphics());
    }


}
